package factory.simplefactory2;

public class HumanFactory {
    private HumanFactory(){}
    private static HumanFactory humanFactory=new HumanFactory();
    public static HumanFactory getHumanFactory(){
        return humanFactory;
    }
    private Human human;

    public Human getHuman(String type) {
        if (type.equals("男人")) {
            this.human = new Man();
        } else if (type.equals("女人")) {
            this.human = new Women();
        } else if (type.equals("机器人")) {
            this.human = new Robot();
        } else {
            System.out.println("你输入有误");
        }
        return human;
    }

    public void setHuman(Human human) {
        this.human = human;
    }
}
